<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Dom选择器</title>
</head>
<body>
    <div id="demo" class="demo"></div>
    <input type="text" name="username">
    <div>
        <p><span></span></p>
    </div>
</body>
<script>
    // document 代表整个文档
    // var div = document.getElementById('demo');
    // var div = document.getElementsByTagName('div');
    var div = document.getElementsByClassName('demo');
    var input = document.getElementsByName('username');

    // 选出元素非实时
    var span = document.querySelector('div > p span');
    var spans = document.querySelectorAll('div > p span');
</script>
</html>
